<?php
	
	require_once 'include/header.inc.php';
		
	$query = mysql_query("SELECT image FROM ".$_GET['table']." WHERE book_id = '".$_GET['id']."'");
	$result = mysql_fetch_array($query, MYSQL_ASSOC);
	$image  = $result['image'];
	
	
	if ($image != NULL) {
		header("Content-type: image/jpeg");
		print $image;
	}
	else {
		// Trego fotogragin noimage.gif
		$filename = "include/styles/default/images/noimage.gif";
		$handle = fopen ($filename, "r");
		$contents = fread ($handle, filesize ($filename));
		header("Content-type: image/jpeg");
		print $contents;
	}
?>